df <- data.frame(x = 1:10, grp1 = rnorm(10, 5, 1), grp2 = rnorm(10, 10, 3))
pie <- data.frame(grp = c("grp1", "grp2"), value = c(6, 4), stringsAsFactors = FALSE)
df %>%
e_charts(x) %>%
e_line(grp1) %>%
e_line(grp2) %>%
e_data(pie, grp) %>%
e_pie(value, rm.x = FALSE, rm.y = FALSE, center = c("80%", "20%"), radius = c(0, 70)) %>%
e_title("Pie and Lines", "Linked legend") %>%
e_tooltip(trigger = "item") %>%
e_theme("shine")Download the image
library(png)
download.file("http://www.gradhacker.org/wp-content/uploads/Rlogo.png", destfile = "Rlogo.png")
png <- readPNG("Rlogo.png", native = FALSE)# extract colors
colors <- c(png[,,1], png[,,2], png[,,3])
# build as matrix of hex colors
matrix <- matrix(colors, nrow = dim(png)[1], ncol = dim(png)[2])
# reshape to x, y, color data.frame
df <- as.data.frame(as.table(matrix))
names(df) <- c("x", "y", "z")
df %>%
e_charts(x) %>%
e_bar_3d(y, z) %>%
e_visual_map(
min = 0,
max = 1,
show = FALSE,
calculable = FALSE
) %>%
e_theme("westeros")